$(function() {
    if ( $(".single_image").length )
        $(".single_image").fancybox({'type' : 'image'});
    
    if ( $("#systemColorPicker").length ){
       $("#systemColorPicker").ColorPicker({
        	onSubmit: function(hsb, hex, rgb, el) {
        		$(el).val(hex);
                $(el).css('backgroundColor', '#' + hex);
        		$(el).ColorPickerHide();
        	},
        	onBeforeShow: function () {
        		$(this).ColorPickerSetColor(this.value);
        	}
        })
        .bind('keyup', function(){
        	$(this).ColorPickerSetColor(this.value);
        }); 
    }
});